﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using FXnaAppBase;

namespace ASApplication
{


    /// <summary>
    /// 计算模型aermap主类
    /// </summary>
    public class AermapRC : RunCommand
    {

        public AermapRC(string exeName, string exeArgs, string workPath)
            : base(exeName, exeArgs, workPath)

        {

 
        }



        public override void BeforeRun()
        {
            base.BeforeRun();

            //查看工作目录中，是否存在对应的exe文件

            string destPath = this.WorkPath+"aermap.exe";


               if (!System.IO.File.Exists(destPath))
               {

                   //取得程序中的文件
                   string m2005Path =ProjectService.CurrentService.GetAppPath(AppPath.EXES) + @"aermap.exe";

                   if (!System.IO.Directory.Exists(this.WorkPath))
                   {
                       System.IO.Directory.CreateDirectory(this.WorkPath);

                       
                   }

                   if (System.IO.File.Exists(m2005Path))
                   {
                       System.IO.File.Copy(m2005Path, destPath);

                   }
                   else
                   {
                       System.Windows.MessageBox.Show("未找到可运行的文件 aermap.exe");
                   }

                   

               }



            //然后的过程就是写inp文件

               ProjectService.CurrentService.Project.ModelData.AermodModel.WriteAermapInp();


          




        }



    }
}
